package com.td.client.gui;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;

import com.td.core.obj.TDGame;
import com.td.core.obj.TDMap;

public class MapRenderer implements TDMap.DrawParams {
	
	private static MapRenderer mr = new MapRenderer();
	
	private Image ground;
	private Image trees;
	
	private MapRenderer() {
		try {
			ground = new Image("data/images/Ground.png");
			trees = new Image("data/images/Trees.png");
		} catch (SlickException e) {
			e.printStackTrace();
		}
	}
	
	public static MapRenderer getInstance() {
		return mr;
	}
	
	public void draw(Graphics g) {
		GameRenderer gr = GameRenderer.getInstance();
		for(int i = 0; i < TDGame.MAX_PLAYERS; i++) {
			int x = i*(BSIZE_X) - gr.getBaseX();
			ground.draw(x, 0);
			trees.draw(x, 0);
			trees.draw(x+SIZE_X+BREAK, 0);
		}
	}
}
